package com.xb.loan.encryptor.handler;


import java.util.HashMap;
import java.util.Map;

public class HandlerManagerImpl implements HandlerManager{
	
	private static Map<String,BussinessHandler> BUSSINESSMAP = new HashMap<String,BussinessHandler>();

	@Override
	public void addHandler(String traceCode, BussinessHandler handler) {
		if(traceCode != null && handler != null){
			BUSSINESSMAP.put(traceCode, handler);
		}
	}

	@Override
	public BussinessHandler getHandler(String tranceCode){
		
		BussinessHandler handler = BUSSINESSMAP.get(tranceCode);
	    
		if(handler == null){
			
			throw new RuntimeException("HandlerManagerImpl.getHandler not found transCode:" + tranceCode);
		}
		
		return handler;
	}
	
}
